<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%@include file="/pageRc/common/common.jsp"%>

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport"
	content="initial-scale=1.0,maximum-scale=1.0,user-scalable=no">
<meta name="format-detection" content="telephone=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="mobile-web-app-capable" content="yes">
<meta name="msapplication-tap-highlight" content="no">

<link rel="stylesheet" href="<%=commonPath%>/pageRc/layui/css/layui.css"
	media="all">
<script type="text/javascript"
	src="<%=commonPath%>/pageRc/js/jquery-1.9.1.min.js"></script>
<script type="text/javascript"
	src="<%=commonPath%>/pageRc/common/utils.js"></script>
<script type="text/javascript"
	src="<%=commonPath%>/pageRc/common/msgTool.js"></script>
<script type="text/javascript"
	src="<%=commonPath%>/pageRc/layui/layui.js"></script>
		<script type="text/javascript"
	src="<%=commonPath %>/pageRc/My97DatePicker/WdatePicker.js"></script>

<title>需求转化率</title>
<style>
.Wdate {
    border: #efefef 1px solid;
    height: 35px;
    width: 190px;
    background: #ffffff url(datePicker.gif) no-repeat right;
}
</style>
<script>
	$(function(){

 	})
	//注意：选项卡 依赖 element 模块，否则无法进行工能性操作
	layui.use('element', function() {
		var element = layui.element();

		//…
	});
	$(document).ready(function(){
		$("#datePicker1").empty().html('<input type="text" id="startDate" name="months" class="Wdate" onClick="WdatePicker({startDate:\'%y-%M\',dateFmt:\'yyyyMM\'})"/>');
		$("#datePicker2").empty().html('<input type="text" id="endDate" name="month" class="Wdate" onClick="WdatePicker({endDate:\'%y-%M\',dateFmt:\'yyyyMM\'})"/>');
	});
	
</script>
<jsp:include page="publicMethod.jsp" />
</head>
<body class="layui-main" style="width: 100%;">
<input type="hidden" value="${positionType}" id="positionType">
	<blockquote class="layui-elem-quote">转化率:&nbsp&nbsp&nbsp&nbsp<span id="hh" style="color:red"></span>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp所有统计数字单位均为"万元"</blockquote>
		<form id="createMsgForm" name="createMsgForm" class="layui-form"
			action="">
			<div class="layui-form-item">
				<div class="layui-inline">
					<div class="layui-inline">
						<select name="proGroupNo" id="proGroupNo"
							lay-filter="proGroupSelect" style="width: 210;">
								<c:forEach items="${groupList}" var="group">
									<option value="${group.proGroupNo}">${group.proGroupName}</option>
								</c:forEach>
						</select>
					</div>
				<%-- 	<div class="layui-inline">
						<select name="proTeamNo" id="proTeamNo" style="width: 210;">
							<c:if test="${positionType=='70'}">
								  <c:forEach items="${teanList}" var="tean">
									<option value="${tean.proTeamNo}">${tean.proTeamName}</option>
								  </c:forEach>
							</c:if>
							<c:if test="${positionType!='70'}">
							<option value="">项目组名称</option>
							<option value="">全部</option>
							<c:forEach items="${teanList}" var="tean">
								<option value="${tean.proTeamNo}">${tean.proTeamName}</option>
							</c:forEach>
							</c:if>
						</select>
					</div> --%>

		    	<div class="layui-inline">
           				月份 : 
		            </div>
					<div id="datePicker1" class="layui-inline">
			                <input type="text" id="startDate" name="startDate" class="Wdate" onClick="WdatePicker({dateFmt:'yyyy-MM-dd'})" placeholder="从"/>
		                   </div>
		                   <div class="layui-inline">
	   					 至
	   				</div>
		                    <div id="datePicker2" class="layui-inline">
			                <input type="text" id="endDate" name="endDate" class="Wdate" onClick="WdatePicker({dateFmt:'yyyy-MM-dd'})"  placeholder="到"/>
		                   </div>
		                   

					<div class="layui-inline">
						<button class="layui-btn" type="button" data-method="doSearchSum" id="doSearchSum" >查询</button>
						<button class="layui-btn" type="button" data-method="doExcel">excel下载</button>
					</div>
				</div>
			</div>
			<div class="layui-form-item" id="dateDiv">
			<table class="layui-table" >
  <thead>
    <tr>
      <th lay-data="{field:'username', width:80}" rowspan="3">团队</th>
      <th lay-data="{field:'amount', width:80}" rowspan="3">月份</th>
      <th lay-data="{field:'amount', width:40}" rowspan="3">营收目标</th>
      <th style="text-align:center;" colspan="3">上线</th>
      <th style="text-align:center;" colspan="3">待上线</th>
      <th style="text-align:center;" colspan="3">正在开发</th>
      <th style="text-align:center;" colspan="3">需求梳理</th>
      <th style="text-align:center;" colspan="3">需求酝酿</th>
    </tr>
    <tr>
      <th lay-data="{field:'province'}" rowspan="2">应计划</th>
      <th lay-data="{field:'city'}" rowspan="2">计划</th>
      <th lay-data="{field:'city'}" rowspan="2">实际</th>
       <th lay-data="{field:'province'}" rowspan="2">应计划</th>
      <th lay-data="{field:'city'}" rowspan="2">计划</th>
      <th lay-data="{field:'city'}" rowspan="2">实际</th>
       <th lay-data="{field:'province'}" rowspan="2">应计划</th>
      <th lay-data="{field:'city'}" rowspan="2">计划</th>
      <th lay-data="{field:'city'}" rowspan="2">实际</th>
       <th lay-data="{field:'province'}" rowspan="2">应计划</th>
      <th lay-data="{field:'city'}" rowspan="2">计划</th>
      <th lay-data="{field:'city'}" rowspan="2">实际</th>
       <th lay-data="{field:'province'}" rowspan="2">应计划</th>
      <th lay-data="{field:'city'}" rowspan="2">计划</th>
      <th lay-data="{field:'city'}" rowspan="2">实际</th>
    </tr>
  </thead>
  <tbody id="detailDiv">
						</tbody>
						<script id="tplSrc" type="text/html">
							 {{#  layui.each(d.needList, function(index, x){}}
							     <tr align="left">
								   <td>{{x.proGroupName==undefined?'':x.proGroupName}}</td>
								   <td>{{x.months==undefined?'':x.months}}</td>
									<td>{{x.goal==undefined?'':x.goal}}</td>
									<td>{{x.onlineAccrualSchedule==undefined?'':x.onlineAccrualSchedule}}</td>
								    <td>{{x.onlineSchedule==undefined?'':x.onlineSchedule}}</td>
									<td>{{x.onlineRealitySchedule==undefined?'':x.onlineRealitySchedule}}</td>
                                    <td>{{x.preonlineAccrualSchedule==undefined?'':x.preonlineAccrualSchedule}}</td>
									<td>{{x.preonlineSchedule==undefined?'':x.preonlineSchedule}}</td>
                                    <td>{{x.preonlineRealitySchedule==undefined?'':x.preonlineRealitySchedule}}</td>
									<td>{{x.devAccrualSchedule==undefined?'':x.devAccrualSchedule}}</td>
									<td>{{x.devSchedule==undefined?'':x.devSchedule}}</td>
									<td>{{x.devRealitySchedule==undefined?'':x.devRealitySchedule}}</td>
                                    <td>{{x.cardingAccrualSchedule==undefined?'':x.cardingAccrualSchedule}}</td>
									<td>{{x.cardingSchedule==undefined?'':x.cardingSchedule}}</td>
									<td>{{x.cardingRealitySchedule==undefined?'':x.cardingRealitySchedule}}</td>
									<td>{{x.brewAccrualSchedule==undefined?'':x.brewAccrualSchedule}}</td>
									<td>{{x.brewSchedule==undefined?'':x.brewSchedule}}</td>
									<td>{{x.brewRealitySchedule==undefined?'':x.brewRealitySchedule}}</td>
								 </tr>
							{{#  }); }} 
					   </script>
</table>
			
			
			</div>
			<div class="layui-form-item">
				<div class="layui-inline">
					<div id="laypageDiv"></div>
				</div>
			</div><button style="margin: 0px;"></button>
		</form>
	</div>
	<input id="totalNum" type="hidden" name="totalNum" >
</body>
<script type="text/javascript">
var path="<%=commonPath%>";
	var msg = new msgTool();
	layui.use([ 'form', 'layer', 'laytpl', 'laypage', 'laydate' ],
	function() {
	var $ = layui.jquery, layer = layui.layer; //独立版的layer无需执行这一句
						var form = layui.form(), layer = layui.layer, laypage = layui.laypage, laytpl = layui.laytpl;
						var active = {
							doSearchSum : function() { //搜索
								var getTpl = tplSrc.innerHTML;
								var dataObj = {
									"proGroupNo" : $("#proGroupNo").val(),
									"proTeamNo" : $("#proTeamNo").val(),
									"startDate": $("#startDate").val(),
									"endDate": $("#endDate").val(),
								}
								msg.sendMsg("/page/main/NeedConversion.do",
									dataObj,function(data) {
										laytpl(getTpl).render(data.body,function(html) {
											detailDiv.innerHTML = html;
											/* $('#hh').html(data.body.re); */
										});
										
								});
							},
							doExcel : function() {
								var dataObj = {
										"proGroupNo" : $("#proGroupNo").val(),
										"proTeamNo" : $("#proTeamNo").val(),
										"startDate": $("#startDate").val(),
										"endDate": $("#endDate").val(),
								}
								msg.sendMsg("/page/main/doExcelNeedConversion.do",
										dataObj, function(data) {
											window.location.href = path
					+ "/downFile/"
					+ data.body.fileName
			});
		}
						
						
						}
						
	$('.layui-btn').on('click',function() {
		var othis = $(this), method = othis.data('method');
		active[method] ? active[method].call(this,othis) : '';
	});
});
	 function flush(){
	        $('#doSearchSum').click();
	    }

	 
	 window.onload=function()
	 {
		var path="<%=commonPath%>";

	    	
	        $.ajax({
	            type : "post",
	            async : true,            //异步请求（同步请求将会锁住浏览器，用户其他操作必须等待请求完成才可以执行）
	            url :path+ "/page/main/Conversion.do",    //请求发送到TestServlet处
	            data : {},
	            dataType : "json",        //返回数据形式为json
	            success : function(result) {
	          	  var data=result.body;
	          	$('#hh').html(data);

	           }
	       })
	 }
	 
	 
	 

</script>

</html>